home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
FromTheMag
/
JW FLV MEDIA PLAYER 4.2
/
mediaplayer.exe
/
player.swf
/
scripts
/
com
/
carlcalderon
/
arthropod
/
Debug.as
Wrap
Text File
|
2008-11-04
|
6KB
|
189 lines
package com.carlcalderon.arthropod
{
import flash.display.BitmapData;
import flash.display.Stage;
import flash.events.StatusEvent;
import flash.geom.Matrix;
import flash.geom.Rectangle;
import flash.net.LocalConnection;
import flash.system.System;
public class Debug
{
public static var LIGHT_BLUE:uint = 52428;
private static const MEMORY_OPERATION:String = "debugMemory";
public static const NAME:String = "Debug";
public static var secureDomain:String = "*";
public static var password:String = "CDC309AF";
private static const ERROR_OPERATION:String = "debugError";
private static const CLEAR_OPERATION:String = "debugClear";
private static const BITMAP_OPERATION:String = "debugBitmapData";
public static const VERSION:String = "0.74";
private static const TYPE:String = "app";
public static var allowLog:Boolean = true;
private static const ARRAY_OPERATION:String = "debugArray";
private static const DOMAIN:String = "com.carlcalderon.Arthropod";
private static const OBJECT_OPERATION:String = "debugObject";
private static const WARNING_OPERATION:String = "debugWarning";
public static var BLUE:uint = 6710988;
private static const CONNECTION:String = "arthropod";
public static var GREEN:uint = 52224;
public static var ignoreStatus:Boolean = true;
private static const CHECK:String = ".161E714B6C1A76DE7B9865F88B32FCCE8FABA7B5.1";
public static var RED:uint = 13369344;
private static const LOG_OPERATION:String = "debug";
public static var secure:Boolean = false;
public static var YELLOW:uint = 13421568;
public static var PINK:uint = 13369548;
private static var lc:LocalConnection = new LocalConnection();
private static var hasEventListeners:Boolean = false;
public function Debug()
{
super();
}
public static function memory() : Boolean
{
return send(MEMORY_OPERATION,System.totalMemory,null);
}
public static function error(param1:*) : Boolean
{
return send(ERROR_OPERATION,String(param1),13369344);
}
public static function warning(param1:*) : Boolean
{
return send(WARNING_OPERATION,String(param1),13421568);
}
private static function send(param1:String, param2:*, param3:*) : Boolean
{
var operation:String = param1;
var value:* = param2;
var prop:* = param3;
if(!secure)
{
lc.allowInsecureDomain("*");
}
else
{
lc.allowDomain(secureDomain);
}
if(!hasEventListeners)
{
if(ignoreStatus)
{
lc.addEventListener(StatusEvent.STATUS,ignore);
}
else
{
lc.addEventListener(StatusEvent.STATUS,status);
}
hasEventListeners = true;
}
if(allowLog)
{
try
{
lc.send(TYPE + "#" + DOMAIN + CHECK + ":" + CONNECTION,operation,password,value,prop);
return true;
}
catch(e:*)
{
return false;
}
}
else
{
return false;
}
}
public static function bitmap(param1:*, param2:String = null) : Boolean
{
var _loc3_:BitmapData = null;
var _loc4_:Matrix = null;
var _loc5_:Number = NaN;
var _loc6_:Rectangle = null;
_loc3_ = new BitmapData(100,100,true,16777215);
_loc4_ = new Matrix();
_loc5_ = 100 / (param1.width >= param1.height ? param1.width : param1.height);
_loc4_.scale(_loc5_,_loc5_);
_loc3_.draw(param1,_loc4_,null,null,null,true);
_loc6_ = new Rectangle(0,0,Math.floor(param1.width * _loc5_),Math.floor(param1.height * _loc5_));
return send(BITMAP_OPERATION,_loc3_.getPixels(_loc6_),{
"bounds":_loc6_,
"lbl":param2
});
}
public static function object(param1:*) : Boolean
{
return send(OBJECT_OPERATION,param1,null);
}
public static function clear() : Boolean
{
return send(CLEAR_OPERATION,0,0);
}
private static function ignore(param1:StatusEvent) : void
{
}
public static function log(param1:*, param2:uint = 16711422) : Boolean
{
return send(LOG_OPERATION,String(param1),param2);
}
public static function array(param1:Array) : Boolean
{
return send(ARRAY_OPERATION,param1,null);
}
public static function snapshot(param1:Stage, param2:String = null) : Boolean
{
if(param1)
{
return bitmap(param1,param2);
}
return false;
}
private static function status(param1:StatusEvent) : void
{
trace("Arthropod status:\n" + param1.toString());
}
}
}